package com.baaio.swing;

import java.util.ArrayList;
import javax.swing.Icon;


public class JOptionPane extends javax.swing.JOptionPane
{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public JOptionPane()
	{

		super();
		
	}

	public JOptionPane(Object message, int messageType, int optionType,
			Icon icon, Object[] options, Object initialValue)
	{

		super(new I18N().getValue((String)(message)), messageType, optionType, icon, getObject(options), initialValue);
		
	}
	
	private static Object[] getObject(Object options)
	{
		ArrayList<String> list = new ArrayList<String>();
		for(String str : (String[])options)
		{
			list.add(new I18N().getValue(str));
		}
		Object[] optionss = new Object[list.size()];
		for(int i = 0; i < list.size();i ++)
		{
			optionss[i] = list.get(i);
		}
		return optionss;
	}

	public JOptionPane(Object message, int messageType, int optionType,
			Icon icon, Object[] options)
	{

		super(new I18N().getValue((String)(message)), messageType, optionType, icon, getObject(options));
		
	}

	public JOptionPane(Object message, int messageType, int optionType,
			Icon icon)
	{

		super(new I18N().getValue((String)(message)), messageType, optionType, icon);
		
	}

	public JOptionPane(Object message, int messageType, int optionType)
	{

		super(new I18N().getValue((String)(message)), messageType, optionType);
		
	}

	public JOptionPane(Object message, int messageType)
	{

		super(new I18N().getValue((String)(message)), messageType);
		
	}

	public JOptionPane(Object message)
	{

		super(message);
		
	}

	@Override
	public void setMessage(Object newMessage)
	{

		super.setMessage(new I18N().getValue((String)(message)));
	}

	@Override
	public void setOptions(Object[] newOptions)
	{

		super.setOptions(getObject(newOptions));
	}

	
}
